x86: Fix max_gsi calculation on systems with discontiguous GSI space.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 19 Aug 2009 11:58:15 +0000 (12:58 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 19 Aug 2009 11:58:15 +0000 (12:58 +0100)
From: Steven Smith <steven.smith@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/io_apic.c
xen/arch/x86/mpparse.c

index 61ff2480e2a9beefeeea4b40e5d64021d5ef320c..917e4dd9b035ad87b356720af6b72d60823c22f6 100644 (file)
@@ -2349,6 +2349,8 @@ void dump_ioapic_irq_info(void)
     }
 }
 
+unsigned highest_gsi(void);
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2390,6 +2392,9 @@ void __init init_ioapic_mappings(void)
             nr_irqs_gsi += nr_ioapic_registers[i];
         }
     }
+
+    nr_irqs_gsi = max(nr_irqs, highest_gsi());
+
     if ( !smp_found_config || skip_ioapic_setup || nr_irqs_gsi < 16 )
         nr_irqs_gsi = 16;
     else if ( nr_irqs_gsi > MAX_GSI_IRQS)
index 5f2be943e2bdf058c5b1b0b4692272b02f49decc..fcbb1a1968f5ec943944c7bd623feebabb4df61e 100644 (file)
@@ -945,6 +945,19 @@ void __init mp_register_ioapic (
        return;
 }
 
+unsigned highest_gsi(void)
+{
+    unsigned x;
+    unsigned res;
+
+    res = 0;
+    for (x = 0; x < nr_ioapics; x++) {
+        if (res < mp_ioapic_routing[x].gsi_end)
+            res = mp_ioapic_routing[x].gsi_end;
+    }
+    return res;
+}
+
 
 void __init mp_override_legacy_irq (
        u8                      bus_irq,